package com.simpleframe.views.chart.attribution;

/**
 * 纵坐标属性
 * @author Administrator
 *
 */
public class ChartYAxis {
	
	/**
	 * 纵坐标的颜色
	 */
	private String colour;
	
	/**
	 * 纵网格的颜色
	 */
	private String gridColour;
	
	/**
	 * 轴线宽度
	 */
	private int stroke;
	
	/**
	 * 轴刻度线高度值
	 * 
	 */
	private int tickHeight;
	
	/**
	 * 纵坐标最小值
	 */
	private double min;
	
	/**
	 * 纵坐标最大值
	 */
	private double max;
	
	/**
	 * 坐标跨度
	 */
	private double steps;
	
	public ChartYAxis(){
		
	}

	public ChartYAxis(String colour, String gridColour, int stroke, int tickHeight,
			int min, int max, int steps) {
		this.colour = colour;
		this.gridColour = gridColour;
		this.stroke = stroke;
		this.tickHeight = tickHeight;
		this.min = min;
		this.max = max;
		this.steps = steps;
	}
	
	/**
	 * 将Y轴的属性以字符串的形式返回
	 * @return
	 */
	public String getYAxisString(){
		StringBuffer sb = new StringBuffer();
		sb.append(ChartTool.addQuotes("y_axis")+":\n");
		sb.append(ChartTool.addHT("{\n"));
		sb.append("\t");
		sb.append(ChartTool.addQuotes("colour") + ":");
		sb.append(ChartTool.addQuotes(colour) + ",\n");

		sb.append("\t");
		sb.append(ChartTool.addQuotes("grid-colour") + ":");
		sb.append(ChartTool.addQuotes(gridColour) + ",\n");
		
		sb.append("\t");
		sb.append(ChartTool.addQuotes("stroke") + ":");
		sb.append(ChartTool.checkField(""+stroke) + ",\n");

		sb.append("\t");
		sb.append(ChartTool.addQuotes("tick-height") + ":");
		sb.append(ChartTool.checkField(""+tickHeight) + ",\n");

		sb.append("\t");
		sb.append(ChartTool.addQuotes("min") + ":");
		sb.append(ChartTool.checkField(""+min) + ",\n");
		
		sb.append("\t");
		sb.append(ChartTool.addQuotes("max") + ":");
		sb.append(ChartTool.checkField(""+max) + ",\n");
		
		sb.append("\t");
		sb.append(ChartTool.addQuotes("steps") + ":");
		sb.append(ChartTool.checkField(""+steps) + "\n");
		
		sb.append(ChartTool.addHT("},\n"));
		return sb.toString();
	}
	
	/**
	 * 默认设定
	 */
	public void DefaultSetting(){
		colour = new String("#000000");
		gridColour = new String("#eeeeee");
		stroke = 1;
		tickHeight =1;
		min = 0;
		max = 100;
		steps = max/5;
	}
	
	/**
	 * 以下为属性的get和set方法
	 * @return
	 */
	
	public String getColour() {
		return colour;
	}

	public void setColour(String colour) {
		this.colour = colour;
	}

	public String getGridColour() {
		return gridColour;
	}

	public void setGridColour(String gridColour) {
		this.gridColour = gridColour;
	}

	public int getStroke() {
		return stroke;
	}

	public void setStroke(int stroke) {
		this.stroke = stroke;
	}

	public int getTickHeight() {
		return tickHeight;
	}

	public void setTickHeight(int tickHeight) {
		this.tickHeight = tickHeight;
	}

	public double getMin() {
		return min;
	}

	public void setMin(double min) {
		this.min = min;
	}

	public double getMax() {
		return max;
	}

	public void setMax(double max) {
		this.max = max;
	}

	public double getSteps() {
		return steps;
	}

	public void setSteps(double steps) {
		this.steps = steps;
	}
	
}
